package be.scond.cartpool;

import java.io.IOException;
import javax.servlet.http.*;
import be.scond.cartpool.API.GroupApi;

public class GroupExistsServlet extends HttpServlet {
	
	static final long serialVersionUID = 1;
	
	public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {
	}
	
	public void doPost(HttpServletRequest req, HttpServletResponse resp) throws IOException {
		resp.setCharacterEncoding("UTF-8");
		resp.setContentType("text/xml");		

		String groupName = req.getParameter("groupName");		
		String respons = "<data>";	

		if(GroupApi.groupExists(groupName)){
			respons += "<succes>true</succes>";		
		}else{
			respons += "<succes>false</succes>";		
		}
			
		respons += "</data>";

		resp.getWriter().print(respons);
	}
}